﻿using System;
using Klear.Library.ViewModels;
using Klear.Library.Services;

namespace Klear.Services;

public class MenuNavigationService : IMenuNavigationService
{
    public void NavigateTo(string view) {
        ViewModelBase viewModel = view switch {
            MenuNavigationConstant.BudgetView => ServiceLocator.Current
                .BudgetViewModel,
            MenuNavigationConstant.CategoryView => ServiceLocator.Current
                .CategoryViewModel,
            MenuNavigationConstant.IncomeExpensesView => ServiceLocator.Current
                .IncomeExpensesViewModel,
            MenuNavigationConstant.GlobalSearchView => ServiceLocator.Current
                .GlobalSearchViewModel,
            MenuNavigationConstant.VisualizationView => ServiceLocator.Current
                .VisualizationViewModel,
            
            _ => throw new Exception("unknown view")
        };

        ServiceLocator.Current.MainViewModel.SetMenuAndContent(view, viewModel);
        
    }
}